﻿//只能输入数字 onkeypress事件调用
function NumOnly(e) 
{
    var key; 
    if (window.event) 
    {
        key = event.keyCode ;
    }
    else
    { 
        key = e.which;
    }
    if ( key > 47 && key < 58 || key == 8 || key==45) 
    {
        return; 
    }
    else if (window.event) 
    {
        window.event.returnValue = null; 
    }
    else 
    {
        e.preventDefault(); //default action associated with the event can be cancelled
    }
} 